<?php

class JsonSnippetHelper {
	private static $request;
	private static $format;

	public static function get_partial($partialName, $partialVariables){
		self::beforeCall();
		$out=get_partial($partialName, $partialVariables);
		self::afterCall();
		return $out;
	}

	public static function include_partial($partialName, $partialVariables){
		self::beforeCall();
		include_partial($partialName, $partialVariables);
		self::afterCall();
	}

	public static function get_component($module, $componentName, $componentVariables){
		self::beforeCall();
		$out=get_component($module, $componentName, $componentVariables);
		self::afterCall();
		return $out;
	}

	public static function include_component($module, $componentName, $componentVariables){
		self::beforeCall();
		include_component($module, $componentName, $componentVariables);
		self::afterCall();
	}



	private static function beforeCall(){
		self::$request=sfContext::getInstance()->getRequest();
		self::$format=self::$request->getRequestFormat();
		self::$request->setRequestFormat('html');
	}

	private static function afterCall(){
		self::$request->setRequestFormat(self::$format);
	}


}


